<?php	
	$rootUrl = '/~N02045914/WebProject/';
	$tabs = array($rootUrl.'home.php' => 'Home',
				  $rootUrl.'games.php' => 'Games',
				  //$rootUrl.'gear.php' => 'Gear',
				  $rootUrl.'users.php' => 'Users',
				  $rootUrl.'cart.php' => 'Cart');
?>

<?php include('authentication.php'); ?>

<html>
<head>
</head>
<body>

<!-----------HEADER---------->
<div id="header">
<div id="logo"></div>

<div id="slogan">
	<h4>For the Hardcore Gamers!</h4>
</div>

<!-----LOGIN----->
<?php 
	if (isset($_GET['LogOut'])) {
		doLogOut();
		header("Location: http://cs.newpaltz.edu/~N02045914/WebProject/home.php");
		echo 'did doLogOut()';
	}
	else if (isset($_POST['LoginEmail'])) {
		doLogIn($_POST['LoginEmail'], $_POST['LoginPassword']);
	}
?>
<?php
	if (isLoggedIn()) {
		echo '<div id="greeting"><ul>
		<li>Welcome Back '.getUserName().'!</li>
		<li><form method="GET" action>
			<input id="logoutButt" name="LogOut" type="submit" value="Log Out">
		</form></li>
		</ul></div>';
	}
	else 
		include('loginbar.php');
?>
<!-----LOGIN----->	 
    
</div>
<!----------HEADER---------->


<!----------NAV-BAR---------->
<div id="nav">
<table>
<tr>
<?php	
	foreach($tabs as $url => $title) 
	{
	?>
		<td class="<?php echo $section==$title ? 'selected' : '' ?>">			
		<a href="<?php echo $url; ?>"><?php echo $title; ?></a></td>
	<?php
	}
?>
</tr>
</table>
</div>
<!----------NAV-BAR---------->

</body>
</html>